//
//  PayWayView.m
//  jianpai
//
//  Created by yrapp on 16/2/2.
//  Copyright © 2016年 yrapp. All rights reserved.
//

#import "PayWayView.h"

@implementation PayWayView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
 
        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 26, kWidth, 49)];
        backView.backgroundColor = [UIColor whiteColor];
        [self addSubview:backView];
        
        UILabel *payLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, 10, 20)];
        payLabel.text = @"需支付";
        [payLabel sizeToFit];
        [backView addSubview:payLabel];
        
        _payPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(kWidth - 116.5,15, 100, 20)];
        _payPriceLabel.textAlignment = NSTextAlignmentRight;
        _payPriceLabel.text = @"360.00元";
        _payPriceLabel.textColor = [UIColor redColor];
        [backView addSubview:_payPriceLabel];
        
        
        UILabel *payWay = [[UILabel alloc] initWithFrame:CGRectMake(15,26+49+15, 10, 20)];
        payWay.text = @"请选择支付方式";
        [payWay sizeToFit];
        payWay.textColor = [UIColor grayColor];
        [self addSubview:payWay];
        
        
        UIView *backWeixin = [[UIView alloc] initWithFrame:CGRectMake(0, payWay.frame.origin.y + 30, kWidth, 50)];
        backWeixin.backgroundColor = [UIColor whiteColor];
        [self addSubview:backWeixin];
        
        
        _weixinButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _weixinButton.frame = CGRectMake(0, 0, kWidth, 50);
        [_weixinButton setImage:[UIImage imageNamed:@"btn_zf"] forState:(UIControlStateNormal)];
        _weixinButton.imageEdgeInsets = UIEdgeInsetsMake(15, kWidth - 15 - 20, 15, 15);
        [backWeixin addSubview:_weixinButton];
        
        UIImageView *wexinImage = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 30, 30)];
        wexinImage.image = [UIImage imageNamed:@"img_weixin"];
        [backWeixin addSubview:wexinImage];
        
        UILabel *wexinImageLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 15, 20, 20)];
        wexinImageLabel.text = @"微信支付";
        [wexinImageLabel sizeToFit];
        [backWeixin addSubview:wexinImageLabel];
        
        
        
        
        UIView *backZhifu = [[UIView alloc] initWithFrame:CGRectMake(0, backWeixin.frame.origin.y + 51, kWidth, 50)];
        backZhifu.backgroundColor = [UIColor whiteColor];
        [self addSubview:backZhifu];
        
        _AliButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _AliButton.frame = CGRectMake(0, 0, kWidth, 50);
        [_AliButton setImage:[UIImage imageNamed:@"btn_zf"] forState:(UIControlStateNormal)];
        _AliButton.imageEdgeInsets = UIEdgeInsetsMake(15, kWidth - 15 - 20, 15, 15);
        [backZhifu addSubview:_AliButton];
        
        UIImageView *zhifuImage = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 30, 30)];
        zhifuImage.image = [UIImage imageNamed:@"img_zhifub"];
        [backZhifu addSubview:zhifuImage];
        
        UILabel *zhifuImageLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 15, 20, 20)];
        zhifuImageLabel.text = @"支付宝支付";
        [zhifuImageLabel sizeToFit];
        [backZhifu addSubview:zhifuImageLabel];
        
        
        _sureButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _sureButton.backgroundColor = [UIColor redColor];
        _sureButton.layer.cornerRadius = 5;
        _sureButton.frame = CGRectMake(15, backZhifu.frame.origin.y + 100, kWidth - 30, 40);
        [_sureButton setTitle:@"确认支付" forState:(UIControlStateNormal)];
        
        [self addSubview:_sureButton];
    }
    return self;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
